/**
 * Created by Administrator on 2018/10/25 0025.
 */

import http from "@/util/http.js";
export default {
    post:http.post,
    get:http.get,
    run(index,param,callback){
        const SITE_URL = BASE.api_path;
        let url =  SITE_URL+"?s="+index;
        let error = (data)=>{
            console.log(data)
        };
        http.post(url,param,function(resp){
            if(resp.code == -10000){
                location.href="#/login";
            }
            callback(resp);
        },error);
    },
    menu(param,cb){this.run("index/index/menu",param,cb)},


    register(param,cb){this.run("index/user/register",param,cb)},
    login(param,cb){this.run("index/user/login",param,cb)},
    logout(cb){this.run("index/user/logout",{},cb)},
    auto_login(cb){this.run("index/user/auto_login",{},cb)},

    user(param,cb){this.run("index/user_center/user",param,cb)},
    msg(param,cb){this.run("index/user_center/msg",param,cb)},
    payment(param,cb){this.run("index/user_center/payment",param,cb)},
    employ(param,cb){this.run("index/user_center/employ",param,cb)},
    update_employ(param,cb){this.run("index/user_center/update_employ",param,cb)},
    server(param,cb){this.run("index/user_center/server",param,cb)},
    update_server(param,cb){this.run("index/user_center/update_server",param,cb)},
    detail(param,cb){this.run("index/user_center/detail",param,cb)},
    update_detail(param,cb){this.run("index/user_center/update_detail",param,cb)},

    good_edit(param,cb){this.run("index/good/edit",param,cb)},
    good_del(param,cb){this.run("index/good/del",param,cb)},
    good_my_simple_list(param,cb){this.run("index/good/my_simple_list",param,cb)},
    good_one(param,cb){this.run("index/good/one",param,cb)},
    good_simple_list(param,cb){this.run("index/good/simple_list",param,cb)},

    my_server_order(param,cb){this.run("index/order/my_server_order",param,cb)},
    my_purchase_order(param,cb){this.run("index/order/my_purchase_order",param,cb)},
    create_server_order(param,cb){this.run("index/order/create_server_order",param,cb)},
    create_purchase_order(param,cb){this.run("index/order/create_purchase_order",param,cb)},


    pay_server_order(param,cb){this.run("index/payment/pay_server_order",param,cb)},
    pay_purchase_order(param,cb){this.run("index/payment/pay_purchase_order",param,cb)},


    admin_employ(param,cb){this.run("index/admin/employ",param,cb)},
    admin_server(param,cb){this.run("index/admin/server",param,cb)},
    admin_user(param,cb){this.run("index/admin/user",param,cb)},
    admin_server_good(param,cb){this.run("index/admin/server_good",param,cb)},
    admin_employ_purchase(param,cb){this.run("index/admin/employ_purchase",param,cb)},
    admin_employ_purchase_order(param,cb){this.run("index/admin/employ_purchase_order",param,cb)},
    admin_server_order(param,cb){this.run("index/admin/server_order",param,cb)},
    admin_payment(param,cb){this.run("index/admin/payment",param,cb)},
    admin_money(param,cb){this.run("index/admin/money",param,cb)},


}